$(document).ready(function() {
        
        var idtempRotina = $('#idTempSol').val();
        var registros =   jQuery("#gridAmostras").jqGrid('getGridParam', 'records');
        $("#qtdAmosInf").val(registros);
        
        jQuery("#gridAmostras").jqGrid({
		caption: "Amostras",  
		url: "intranet/Rotina/getamostras/idtempRotina/"+idtempRotina,  
		editurl: "intranet/rotina/removeamostrat/idtemp/"+idtempRotina,
                datatype: "json",  
		colNames:['Identifica&ccedil;&atilde;o da Amostra','Inicial', 'Cliente','Ação'],  
		colModel:[
 
			{name:'idAmostra', index:'idAmostra', width:160, align:"center"},
			{name:'inicial', index:'inicial', width:100, align:"left"},
                        {name:'nomeCurto', index:'nomeCurto', width:150, align:"left"},
                        {name:'acoes',index:'acoes', width:60, align:"center", sortable:false}
                ],
		
		width: "500", 
		height: "250",
		pager: '#navAmostras',  
		sortname: "idAmostra",  
		sortorder: "ASC",  
		multiselect: false,  
		viewrecords: false,  
                subGrid: false,
                scroll:true,
                toolbar: [true,"top"],
                gridComplete: function(){
			var ids = jQuery("#gridAmostras").jqGrid('getDataIDs');				
			for(var i=0; i < ids.length; i++){
				var cl = ids[i];
                                       ce = '<img class="btnDeletar" rel="'+cl+'" src="public/images/cross.png" title="Deletar" style="cursor:pointer; margin:2px" />'; jQuery("#gridAmostras").jqGrid('setRowData',ids[i],{acoes:ce});
                                  jQuery("#gridAmostras").jqGrid('setRowData',ids[i],{acoes:ce});
			}
                        $('.btnDeletar').click(function(){
                           var idAmostra = $(this).attr('rel');
                            jQuery('#gridAmostras').jqGrid('delGridRow',idAmostra);
                         });
		}
		}).navGrid("#navAmostras",{
		
		edit: false, 
		add: false, 
		del: false, 
		search: false, 
		view: false,
		refresh: true 
	});
    
        
       
});
jQuery("#gridAmostras").jqGrid('navGrid','#navAmostras',{edit:false,add:false,del:false,view: false});

